import request from "@/request/request";

// 登录
export function login(data) {
  return request({
    url: "/dev-api/portal/user/login",
    method: "post",
    data,
  });
}
// 验证码
export function getCodeImg(data) {
  return request({
    url: "/dev-api/portal/user/createCode",
    method: "get",
    responseType: 'blob',
    params: data,
  });
}
// 退出登录
export function logOut(data) {
  return request({
    url: "/dev-api/portal/user/logout",
    method: "get",
    data,
  });
}
// 发送邮箱验证码-登录后
export function sendEmail(params) {
  return request({
    url: "/dev-api/auth/sendEmailCodeLogin",
    method: "get",
    params,
  });
}
// 发送邮箱验证码-登录前
export function sendEmail2(params) {
  return request({
    url: "/dev-api/auth/emailBuildingCode",
    method: "get",
    params,
  });
}
// 发送邮箱验证码-修改绑定邮箱
export function sendEmail3(params) {
  return request({
    url: "/dev-api/system/user/profile/changeEmail",
    method: "get",
    params,
  });
}
// 根据验证码进行登录
export function emailLogin(params) {
  return request({
    url: "/dev-api/auth/emailCodeLogin",
    method: "get",
    params,
  });
}
// 忘记密码 发送邮箱验证码
export function forgetEmailLogin(params) {
  return request({
    url: "/dev-api/auth/sendEmailCodeForget",
    method: "get",
    params,
  });
}
// 根据绑定邮箱更换密码
export function changeLoginPwd(data) {
  return request({
    url: "/dev-api/auth/passwordForget",
    method: "put",
    data,
  });
}
// 获取限制登录的所有用户
export function restrictionAll(params) {
  return request({
    url: "/dev-api/system/user/getAllLimitLogin",
    method: "get",
    params,
  });
}
// 手机验证码登录
export function phoneLogin(data) {
  return request({
    url: "/dev-api/auth/smsLogin",
    method: "post",
    data,
    headers: {
      enterprise_id: "1581868639098753026",
      source_name: "25dea081aeb34f8e88f467a3306c33fa",
    },
  });
}
// 手机号登录发送短信验证码
export function sendPhone(params) {
    return request({
      url: "/dev-api/auth/sendPhoneCoede",
      method: "get",
      params,
      headers: {
        enterprise_id: "1581868639098753026",
        source_name: "25dea081aeb34f8e88f467a3306c33fa",
      },
    });
  }
  // 手机号登录发送短信验证码
export function sendPhoneReset(params) {
  return request({
    url: "/dev-api/auth/passwordResetCode",
    method: "get",
    params,
    headers: {
      enterprise_id: "1581868639098753026",
      source_name: "25dea081aeb34f8e88f467a3306c33fa",
    },
  });
}
  
  //手机号验证码忘记密码
export function sendChangePhone(data) {
  return request({
    url: "/dev-api/auth/passwordReset",
    method: "put",
    data,
    headers: {
      enterprise_id: "1581868639098753026",
      source_name: "25dea081aeb34f8e88f467a3306c33fa",
    },
  });
}
 // 手机号登录发送短信验证码-更换手机号
 export function sendPhoneUpdate(params) {
  return request({
    url: "/dev-api/auth/updatePhoneCode",
    method: "get",
    params,
  });
}